import 'dart:io';

import 'package:aichat_flutter_wallet/module/module_dapp/widgets/components/dapp_tip_com.dart';
import 'package:aichat_flutter_wallet/module/module_dapp/widgets/hover_status.dart';
import 'package:aichat_flutter_wallet/module_common/utils/colors.dart';
import 'package:aichat_flutter_wallet/module_common/widgets/image/public_image.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class DAppList extends StatelessWidget {
  DAppList(
      {super.key,
      required this.name,
      this.tagName = '',
      this.statement = '',
      this.introduce = '',
      required this.image,
      this.description = '',
      required this.onClick});

  String name;
  String tagName;
  String image;
  String statement;
  String introduce;
  String description;
  Function onClick = () {};

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return HoverStatus(
      defaultColor: Color.fromRGBO(255, 255, 255, 1),
      hoverColor: Color.fromRGBO(246, 246, 246, 1),
      onPressed: () {
        onClick();
      },
      child: Container(
        width: double.infinity,
        padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 12.w, bottom: 12.w),
        child: Row(
          children: [
            ClipRRect(
              borderRadius: BorderRadius.circular(46),
              child: PublicImage(
                image: image,
                width: 46.w,
                height: 46.w,
              ),
            ),
            SizedBox(
              width: 10.w,
            ),
            Expanded(
                flex: 1,
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Row(
                      children: <Widget>[
                        Text(
                          name,
                          style: TextStyle(
                              fontSize: 14.sp, fontWeight: FontWeight.w500, color: Color.fromRGBO(51, 51, 51, 1)),
                        ),
                        SizedBox(
                          width: 3.w,
                        ),
                        if (statement.length > 0) DappTips(title: statement)
                      ],
                    ),
                    SizedBox(
                      height: 3.w,
                    ),
                    Text(
                      introduce,
                      overflow: TextOverflow.ellipsis,
                      maxLines: 1,
                      style: TextStyle(
                          fontSize: 12.sp, fontWeight: FontWeight.w400, color: Color.fromRGBO(134, 131, 145, 1)),
                    )
                  ],
                ))
          ],
        ),
      ),
    );
  }
}
